//判断生日是周几
//1.创建生日那天的Date对象
var birthday = new Date('2018/5/10');
//2.查看是周几
var week = birthday.getDay();
console.log(week);
//3.根据周几，减去对应的值
switch(week){
  case 1:
    birthday.setDate(birthday.getDate()-1);
    break;
  case 2:
	birthday.setDate(birthday.getDate()-2);
    break;
  case 3:
	birthday.setDate(birthday.getDate()-3);
    break;
  case 4:
	birthday.setDate(birthday.getDate()-4);
    break;
  case 5:
	birthday.setDate(birthday.getDate()-5);
    break;
}

console.log(birthday.toLocaleString());